<template>
  <div id="app">
    <router-link to="/home" tag="button" replace>首页</router-link>
    <router-link to="/about" tag="button" replace>关于</router-link>
     <router-link :to="'/user/'+userId" tag="button" replace>用户</router-link>
     <router-link :to="profile" tag="button" replace>个人信息</router-link>
    <!-- 
      <button @click="homeClick">首页</button>
      <button @click="aboutClick">关于</button> 
      <button @click="profileClick">手动个人信息</button> 
    -->
    <keep-alive exclude="profile,user"><router-view></router-view></keep-alive> 
  </div>
</template>

<script>

export default {
  name: 'App',
  data(){
    return {
      userId:'wangzhen',
      profile:{
        path:'/profile',
        query:{
          name:'wangzhen',
          age:24,
          sex:'男'
        }
      }
    }
  },
  methods:{
    homeClick(){
      this.$router.replace('/home')
    },
    aboutClick(){
       this.$router.replace('/about')
    },
    profileClick(){
       this.$router.replace(this.profile)
    }
  }
}
</script>
<style>
 .activeWZ{
   color: blue;
 }
</style>
